package cn.bellychang.ood.atmsimulator.model;

import cn.bellychang.ood.atmsimulator.CardReaderEnum;
import cn.bellychang.ood.atmsimulator.Observer;

/**
 * @author ChangLiang
 * @date 2020/5/21
 */
public class Display implements Observer {

    /**
     * 观察用户插入了卡
     *
     * @param cardNo
     */
    @Override
    public void update(CardReaderEnum action, String cardNo) {
        switch (action) {
            case INSERT_CARD:
                display("welcome " + cardNo + " please input password");
                break;
            case EJECT_CARD:
                display("thank you and goodbye");
                break;
            case EAT_CARD:
                display("sorry, you failed too much time so eat card");
                break;
            default:
                break;
        }
    }

    public void display(String str) {
        System.out.println(str);
    }
}
